<template>
  <div>  
      <h1>{{article.title}}</h1>
      <h1>{{article.body}}</h1>
  </div>
</template>

<script>
import axios from "axios"

export default {
   name:"article",
   async asyncData(context){
     const { data } = await axios({
         method:"GET",
         url:"http://localhost:3000/data.json"
     })
     const id = Number.parseInt(context.params.id)
     return {
        article: data.posts.find(item => item.id === id)
     }
  }
}
</script>

<style>

</style>